import 'package:flutter_taotaoshipin/generated/json/base/json_convert_content.dart';
import 'package:flutter_taotaoshipin/model/user_login_entity.dart';

UserLoginEntity $UserLoginEntityFromJson(Map<String, dynamic> json) {
  final UserLoginEntity userLoginEntity = UserLoginEntity();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    userLoginEntity.id = id;
  }
  final String? sessionId = jsonConvert.convert<String>(json['session_id']);
  if (sessionId != null) {
    userLoginEntity.sessionId = sessionId;
  }
  final int? accountType = jsonConvert.convert<int>(json['account_type']);
  if (accountType != null) {
    userLoginEntity.accountType = accountType;
  }
  final UserLoginPlay? play = jsonConvert.convert<UserLoginPlay>(json['play']);
  if (play != null) {
    userLoginEntity.play = play;
  }
  final UserLoginDye? dye = jsonConvert.convert<UserLoginDye>(json['dye']);
  if (dye != null) {
    userLoginEntity.dye = dye;
  }
  return userLoginEntity;
}

Map<String, dynamic> $UserLoginEntityToJson(UserLoginEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['session_id'] = entity.sessionId;
  data['account_type'] = entity.accountType;
  data['play'] = entity.play?.toJson();
  data['dye'] = entity.dye?.toJson();
  return data;
}

extension UserLoginEntityExtension on UserLoginEntity {
  UserLoginEntity copyWith({
    int? id,
    String? sessionId,
    int? accountType,
    UserLoginPlay? play,
    UserLoginDye? dye,
  }) {
    return UserLoginEntity()
      ..id = id ?? this.id
      ..sessionId = sessionId ?? this.sessionId
      ..accountType = accountType ?? this.accountType
      ..play = play ?? this.play
      ..dye = dye ?? this.dye;
  }
}

UserLoginPlay $UserLoginPlayFromJson(Map<String, dynamic> json) {
  final UserLoginPlay userLoginPlay = UserLoginPlay();
  final bool? auto = jsonConvert.convert<bool>(json['auto']);
  if (auto != null) {
    userLoginPlay.auto = auto;
  }
  final int? dramaId = jsonConvert.convert<int>(json['drama_id']);
  if (dramaId != null) {
    userLoginPlay.dramaId = dramaId;
  }
  final int? sort = jsonConvert.convert<int>(json['sort']);
  if (sort != null) {
    userLoginPlay.sort = sort;
  }
  return userLoginPlay;
}

Map<String, dynamic> $UserLoginPlayToJson(UserLoginPlay entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['auto'] = entity.auto;
  data['drama_id'] = entity.dramaId;
  data['sort'] = entity.sort;
  return data;
}

extension UserLoginPlayExtension on UserLoginPlay {
  UserLoginPlay copyWith({
    bool? auto,
    int? dramaId,
    int? sort,
  }) {
    return UserLoginPlay()
      ..auto = auto ?? this.auto
      ..dramaId = dramaId ?? this.dramaId
      ..sort = sort ?? this.sort;
  }
}

UserLoginDye $UserLoginDyeFromJson(Map<String, dynamic> json) {
  final UserLoginDye userLoginDye = UserLoginDye();
  final int? chnId = jsonConvert.convert<int>(json['chn_id']);
  if (chnId != null) {
    userLoginDye.chnId = chnId;
  }
  final String? ver = jsonConvert.convert<String>(json['ver']);
  if (ver != null) {
    userLoginDye.ver = ver;
  }
  final String? agentName = jsonConvert.convert<String>(json['agent_name']);
  if (agentName != null) {
    userLoginDye.agentName = agentName;
  }
  return userLoginDye;
}

Map<String, dynamic> $UserLoginDyeToJson(UserLoginDye entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['chn_id'] = entity.chnId;
  data['ver'] = entity.ver;
  data['agent_name'] = entity.agentName;
  return data;
}

extension UserLoginDyeExtension on UserLoginDye {
  UserLoginDye copyWith({
    int? chnId,
    String? ver,
    String? agentName,
  }) {
    return UserLoginDye()
      ..chnId = chnId ?? this.chnId
      ..ver = ver ?? this.ver
      ..agentName = agentName ?? this.agentName;
  }
}